package zms.roya.math.digui.orgtree;

import java.util.ArrayList;
import java.util.List;

public class View {
	
	DAO dao=new DAO();
	public void printTree(int orgid, int Level) {
		List<Org> ls = new ArrayList<Org>();
		String prestr = "  ";
		for (int i = 0; i < Level; i++) {
			prestr = prestr + "  ";
		}
		String queryStr = "select orgid,orgname from org where parid=" + orgid+ ";";
		System.out.println(prestr + "-" + dao.getOrgName(orgid));
		ls = dao.getChildenByID(queryStr);
	    if (!ls.isEmpty())
	    {
	       for (int x=0; x<ls.size();x++)
	       {
	    	 
	    	   printTree( ls.get(x).getOrgid(),Level+1);
	       }
	    }
 
	}

}
